package com.rjj.wlqq.listen.myListen;

import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author renjianjun
 * @date 2020/8/14 17:03
 * @email 215060580@qq.com
 */
@Controller
public class ListenController {
    @Resource
    private ApplicationContext applicationContext;

    @RequestMapping("/listen")
    @ResponseBody
    public String index(){
        Map<String,Object> map = new HashMap<>();
        map.put("a","你啊");

        //发布一下我们的监听
        MyEvent myEvent = new MyEvent(this,map);
        applicationContext.publishEvent(myEvent);
        return "d";
    }
}
